// pages/my/nextZc/nextZc.js
const app = getApp();
Page({
  interdl(){
    if(this.data.password != this.data.realPassword){
      this.setData({
        message: '密码错误，请重新输入 !'
      })
    }else{
      this.setData({
        message: ''
      })
      let that = this;
      wx.request({
        url: that.data.url+'user/add',
        method: 'POST',
        data: {
          userName: that.data.userName,
          password: that.data.password,
          phone: that.data.phone
        },
        success(resp){
          let result = resp.data;
          wx.navigateTo({
            url: '../dlOK/dlOK',
          })
        }
      })
     
    }
    
  },
  /**
   * 页面的初始数据
   */
  data: {
    isAgreed:false,
    url: '',
    userName: '',
    password: '',
    realPassword: '',
    message: '',
    phone: ''
  },
  onAgreementChange: function(e){
    this.setData({
      isAgreed:e.detail.value.length > 0
    });
  },
  // 注册
  inputUserName(e){
    let value = e.detail.value;
    this.setData({
      userName: value,
    });
  },
  inputPassword(e){
    let value = e.detail.value;
    this.setData({
      password: value,
    });
  },
  inputRealPassword(e){
    let value = e.detail.value;
    this.setData({
      realPassword: value,
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      url: app.globalData.URL,
      phone: options.phone
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})